import pd.struct.*;
import pd.struct.statement.*;

/**
 *
 * @author Joshua Swank
 */
public class Driver
{
    public static void main( String[] args )
    {
        ScriptTree tree = new ScriptTree( new StatementObject( StatementType.BLOCK ));

        ScriptTreeIterator iterator = tree.createIterator( Traversal.POSTORDER );
        iterator.next();

        iterator.addChild( new StatementObject( StatementType.IF ));
        iterator.addChild( new StatementObject( StatementType.WHILE ));
        iterator.addChild( new StatementObject( StatementType.RETURN ));

        iterator.toChild( 0 );
        iterator.addChild( new StatementObject( StatementType.CALL ));

        iterator.toParent();
        iterator.toChild( 1 );
        iterator.addChild( new StatementObject( StatementType.FOR ) );
        iterator.addChild( new StatementObject( StatementType.ASSIGNMENT ));

        iterator.toChild( 0 );
        iterator.addChild( new StatementObject( StatementType.GOTO ));

        OrderedScriptForest forest = tree.getSubforest( 1, 2, Traversal.POSTORDER );
        System.out.println( forest );
    }
}
